<template>
	<view class="page">
		<view class="list">
			<view class="card" v-for=" item,index in dataForm" :key="index">

				<image style="width: 162rpx;height: 162rpx;border-radius: 16rpx;" :src="item.photo" mode="aspectFill">
				</image>
				<view class="left">
					<view class="carNum">
						{{item.numberplate}}
					</view>
					<view class="driverInfo">
						<span>{{item.name}}</span>
						<u-line direction='col'></u-line>
						<span>{{item.driveAge}}</span>
						<u-line direction='col'></u-line>
						<span>{{item.orderVolume}}</span>

					</view>
					<view class="price">
						<span class="money">￥{{item.startingPrice}}</span>
						<span>/起步价</span>
					</view>
				</view>
				<view class="right">
					<span class="status"> {{item.type==0?'空闲中':'已接单'}}</span>
				</view>
			</view>

		</view>
		<view class="">

		</view>
		<view class="bottom">
			<view class="btn" @tap="orderWrite">
				预约用车
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				dataForm: [

				]

			}
		},
		mounted() {
			this.getWholeCar()
		},
		onLoad() {
			uni.startPullDownRefresh();
		},
		methods: {
			onPullDownRefresh() {
				this.getWholeCar()
				setTimeout(() => {
					uni.stopPullDownRefresh(); // 结束下拉刷新状态
					// 更新页面数据等操作...
				}, 1000);
			},
			orderWrite() {
				uni.navigateTo({
					url: "/pagesTaxi/Taxi/orderWrite"
				})
			},
			getWholeCar() {
				this.$api.get('/travel/travel/rentalcarylbmcar/whole').then(res => {
					if (res.data.code == 0) {
						this.dataForm = res.data.data
					}
					console.log(res, 'res');
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.page {
		height: 100vh;
		background: #F5F8FA;
		position: relative;
	}

	.list {
		display: flex;
		flex-direction: column;
		padding: 20rpx;

		.card {
			background: #fff;
			border-radius: 16rpx;
			margin-bottom: 20rpx;
			padding: 16rpx;
			display: flex;
			flex-direction: row;

			.left {
				width: 44%;
				color: #797979;
				display: flex;
				flex-direction: column;
				justify-content: space-between;
				margin-left: 22rpx;
				padding: 10rpx 0;

				.carNum {
					font-weight: 700;
					font-size: 34rpx;
					color: black;
				}

				.driverInfo {
					display: flex;
					width: 94%;
					flex-direction: row;
					justify-content: space-between;
				}

				.price {
					flex-direction: row;
					display: flex;
					justify-content: flex-start;
					align-items: center;

					.money {
						color: red;
						font-size: 30rpx;
					}
				}
			}

			.right {
				margin: 30rpx 0 0 72rpx;

				.status {
					padding: 9rpx 15rpx;
					color: #33AFFC;
					border: 1rpx solid #33AFFC;
					border-radius: 27rpx;
				}
			}

		}
	}

	.bottom {
		background: #fff;
		position: absolute;
		height: 10%;
		display: flex;
		width: 100%;
		bottom: 0;

		.btn {
			background: #33AFFC;
			width: 70%;
			height: 80rpx;
			border-radius: 81rpx;

			color: #fff;
			line-height: 80rpx;
			text-align: center;
			margin: auto;

		}
	}
</style>